﻿using CrawlerApp.Core.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace CrawlerApp.Infrastructure.Data.Config
{
    public class AccountConfiguration : IEntityTypeConfiguration<Account>
    {
        public void Configure(EntityTypeBuilder<Account> builder)
        {
            builder.HasIndex(b => b.UserName)
                .IsUnique();

            builder.Property(b => b.UserName)
                .IsRequired()
                .HasMaxLength(20);

            builder.Property(b => b.Password)
                .HasMaxLength(40);

            builder.HasIndex(b => b.Email)
                .IsUnique();

            builder.HasIndex(b => b.Phone)
                .IsUnique();
        }
    }
}
